package com.itboye.system.logger;

import com.mchange.v2.c3p0.ComboPooledDataSource;

import java.sql.Connection;
import java.sql.SQLException;

/**
 * 获取数据库连接 ,要保证在 数据库连接池中
 * @version  1.0
 * @author hebidu
 * @date 16/5/11.
 */
public class ByDbConnectionLogger {

    private static ComboPooledDataSource ds = new ComboPooledDataSource();

    public static final ThreadLocal<Connection> localPage = new ThreadLocal<Connection>();

    public static Connection getConnection() {

        try {
            
            return ds.getConnection();

        } catch (SQLException e) {

            throw new RuntimeException(e);

        }finally {

        }
    }

}
